<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    
  </style>
</head>
<body>
  
</body>
<script>

  const target = {
    msg:"hello world",
    name:"target",
    age:20
  }

  const obj = {};

  for(let i in target){
    obj["get "+i] = function(){
      return target[i];
    }
    obj["set "+i] = function(val){
      target[i] = val;
    }
  }

  console.log( obj["get name"]() );


  // get和set关键字问题：无法动态绑定访问器和控制器


  function fn1(){
    console.log("数据被访问了")
  }
  function fn2(val){
    console.log("数据被修改成了：", val)
  }
  
  
</script>
</html>